package oriol.forns.gutierrez;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class Intro extends Activity {
    /** Called when the activity is first created. */
	
	Thread logoTimer;
	boolean stopped;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        GV.Screen.metrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(GV.Screen.metrics);
        
        stopped = false;
        ImageView rodeta = (ImageView)findViewById(R.id.roda_petita);
		Animation animp = AnimationUtils.loadAnimation(this, R.anim.gira_petita);
		ImageView roda = (ImageView)findViewById(R.id.roda_gran);
		Animation animg = AnimationUtils.loadAnimation(this, R.anim.gira_gran);
		rodeta.startAnimation(animp);
		roda.startAnimation(animg);
		
		logoTimer = new Thread() {
		    public void run(){
		        try{
		        sleep(2000);
		            if(!stopped) {
		                Intent i = new Intent("oriol.forns.gutierrez.MENU");
		                startActivity(i);
		            }
		        } catch (InterruptedException e) {
		            e.printStackTrace();
		        }
		        finally{
		        	finish();
		        }
		    }
		};
		logoTimer.start();
    }
}